/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package EntityBeans;

import java.io.Serializable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Keith Augustsson
 */
@Entity
@Table(name = "groupbooking")
@NamedQueries({@NamedQuery(name = "Groupbooking.findAll", query = "SELECT g FROM Groupbooking g"), @NamedQuery(name = "Groupbooking.findByLeader", query = "SELECT g FROM Groupbooking g WHERE g.groupbookingPK.leader = :leader"), @NamedQuery(name = "Groupbooking.findByMember", query = "SELECT g FROM Groupbooking g WHERE g.groupbookingPK.member = :member")})
public class Groupbooking implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected GroupbookingPK groupbookingPK;

    public Groupbooking() {
    }

    public Groupbooking(GroupbookingPK groupbookingPK) {
        this.groupbookingPK = groupbookingPK;
    }

    public Groupbooking(String leader, String member) {
        this.groupbookingPK = new GroupbookingPK(leader, member);
    }

    public GroupbookingPK getGroupbookingPK() {
        return groupbookingPK;
    }

    public void setGroupbookingPK(GroupbookingPK groupbookingPK) {
        this.groupbookingPK = groupbookingPK;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (groupbookingPK != null ? groupbookingPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Groupbooking)) {
            return false;
        }
        Groupbooking other = (Groupbooking) object;
        if ((this.groupbookingPK == null && other.groupbookingPK != null) || (this.groupbookingPK != null && !this.groupbookingPK.equals(other.groupbookingPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "EntityBeans.Groupbooking[groupbookingPK=" + groupbookingPK + "]";
    }

}
